<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>changeDirection</title>
  <!-- 怎么用一张icon实现两张icon的切换效果 -->
  <style>
    .triangle{
      width: 0;
      height: 0;
      border-top: 42px solid transparent;
      border-bottom: 42px solid transparent;
      border-left: 66px solid gray;
    }
  </style>
</head>
<body>
  <div class="triangle">value</div>
</body>
<script>
  let opposite = document.querySelector(".triangle")
  let num = 1
  opposite.onclick = function (event) {
    if(num === 1){
      opposite.style.transform = 'scalex(' + '-1)'
      num = -1
    }else{
      opposite.style.transform = 'scalex(' + '1)'
      num = 1
    }
  }
</script>
</html>